

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Locale;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;



public class Location{

	double LATITUDE = 37.42233;
	double LONGITUDE = -122.083;
	
	static String xmlString;


	public static void main(String[] args) {

		String address = "Winnet";
		address = address.replaceAll(" ","%20");
		
		xmlString = getLocationInfo(address);
		
		System.out.println("xml: "+xmlString);
		

	}

	public static String getLocationInfo(String address) {

		HttpGet httpGet = new HttpGet("http://maps.googleapis.com/maps/api/geocode/json?address="+address+"ka&sensor=false");
		HttpClient client = new DefaultHttpClient();
		HttpResponse response;
		StringBuilder stringBuilder = new StringBuilder();

		try {
			response = client.execute(httpGet);
			
			HttpEntity entity = response.getEntity();
			InputStream stream = entity.getContent();
			int b;
			while ((b = stream.read()) != -1) {
				stringBuilder.append((char) b);
			}
		} catch (ClientProtocolException e) {
		} catch (IOException e) {
		}


		return stringBuilder.toString();
	}



}